package com.foundersoftware.struts.menu.demo.action;

import java.util.ArrayList;

import net.sf.navigator.menu.MenuComponent;
import net.sf.navigator.menu.PermissionsAdapter;

/**
 * 
 * @author JiDong
 * @create December 18.2009
 * 
 */
public class SimplePermissionsAdapter implements PermissionsAdapter {
	private ArrayList menuNames;
	
	public boolean isAllowed(MenuComponent menu) {
		return !menuNames.contains(menu.getName());
	}

	/**
	 * Creates a new instance of SimplePermissionAdapter
	 */
	public SimplePermissionsAdapter(String[] theMenuNames) {
		menuNames = new ArrayList();

		if (theMenuNames != null) {
			for (int i = 0; i < theMenuNames.length; i++) {
				menuNames.add(theMenuNames[i]);
			}
		}
	}
}
